# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-pytest-socket
pkgver=0.6.0
pkgrel=0
pkgdesc="Pytest Plugin to disable socket calls during tests"
url="https://github.com/miketheman/pytest-socket"
arch="noarch"
license="MIT"
depends="py3-pytest"
makedepends="
	poetry
	py3-gpep517
	py3-wheel
	"
checkdepends="py3-pytest-httpbin"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/miketheman/pytest-socket/archive/refs/tags/$pkgver.tar.gz"
options="net" # Required for tests
builddir="$srcdir/pytest-socket-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# tests/test_async.py requires py3-httpx which is not available on ppc64le
	.testenv/bin/python3 -m pytest -k 'not test_starlette and not test_asynctest' \
		--ignore tests/test_async.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
b70ab9fe3c41a707f16b6ae23d45e07238d03a731b3f99b794a6707303cd0301b75360ea164b7de48e9f2d56b5544e2da39373ba14a3b0fc20ef03afce03ab03  py3-pytest-socket-0.6.0.tar.gz
"
